home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr50 / idpds10.zip / IDOOR.BAS < prev    next >
BASIC Source File  |  1993-04-09  |  12KB  |  423 lines

  1. DEFINT A-Z
  2.  
  3. REM $INCLUDE: 'IDOOR.bi'
  4. REM $DYNAMIC
  5.  
  6. DECLARE SUB AnsiAvatarDemo ()
  7. DECLARE SUB ColorCodeDemo ()
  8. DECLARE SUB DialogBoxDemo ()
  9. DECLARE SUB GetRestoreDemo ()
  10. DECLARE SUB InputDemo ()
  11. DECLARE SUB MakeWindowDemo ()
  12. DECLARE SUB MusicDemo ()
  13. DECLARE SUB DetectDemo ()
  14. DECLARE SUB OpeningScreen ()
  15.  
  16. Initialize
  17.  
  18. IF DisplayType = 0 THEN
  19.   PRINT "Sorry!  This DEMO requires ANSI or AVATAR to run!  Change the appropriate"
  20.   PRINT "setting in the DOOR INFO file!"
  21.   END
  22. END IF
  23. RANDOMIZE TIMER
  24.  
  25. DO
  26.  
  27.   OpeningScreen
  28.   REDIM List$(10)
  29.   List$(1) = "1. General Info"
  30.   List$(2) = "2. Dialog Box Demo"
  31.   List$(3) = "3. Ansi/Avatar Demo"
  32.   List$(4) = "4. Make Window Demo"
  33.   List$(5) = "5. Input Demo"
  34.   List$(6) = "6. Save/Restore Demo"
  35.   List$(7) = "7. Color Code Demo"
  36.   List$(8) = "8. Play ANSI Music"
  37.   List$(9) = "9. ANSI/AVATAR Detect"
  38.   List$(10) = "10. Exit DD Demo"
  39.   ch = DialogBox(List$(), 7, 28, 10, 21, "N", "N", "Y", 1, 9, 0, 1, 7)
  40.  
  41.   SELECT CASE ch
  42.     CASE 1
  43.       SELECT CASE DisplayType
  44.         CASE 1
  45.           ch2 = SendAnsi("GENINFO")
  46.         CASE 2
  47.           ch2 = SendAvatar("GENINFO")
  48.       END SELECT
  49.       EnterKey "Press [|MENTER|B] to continue.", 9, 0, 23, 1
  50.     CASE 2
  51.       DialogBoxDemo
  52.     CASE 3
  53.       AnsiAvatarDemo
  54.     CASE 4
  55.       MakeWindowDemo
  56.     CASE 5
  57.       InputDemo
  58.     CASE 6
  59.       GetRestoreDemo
  60.     CASE 7
  61.       ColorCodeDemo
  62.     CASE 8
  63.       MusicDemo
  64.     CASE 9
  65.       DetectDemo
  66.     CASE 10, -1
  67.       ExitDoor
  68.       CLS
  69.       END
  70.   END SELECT
  71.  
  72. LOOP
  73.  
  74. REM $STATIC
  75. SUB AnsiAvatarDemo
  76.  
  77.   DisplayTypeOld = DisplayType
  78.  
  79.   ChangeColor 0, 0
  80.   ClearWindow
  81.  
  82.   MakeWindow 1, 30, 3, 49, "", "", 1, 9, 0, 1, 0
  83.   SendColorLine 2, 32, "ANSI/AVATAR Demo", 7, 1
  84.   MakeWindow 5, 6, 12, 74, "", "", 1, 9, 0, 1, 0
  85.  
  86.   crlf$ = CHR$(13) + CHR$(10)
  87.   SendColorLine 6, 8, "INSTA-DOOR has a built in ANSI/AVATAR 0,0+ DRIVER for you" + crlf$, 7, 1
  88.   SendColorLine 7, 8, "to use, eliminating the need for ANSI.SYS to be installed.  The" + crlf$, 7, 1
  89.   SendColorLine 8, 8, "driver writes directly to video memory, for greatest speed and" + crlf$, 7, 1
  90.   SendColorLine 9, 8, "efficiency.  Any ANSI/AVATAR file (unlimited size!) can be" + crlf$, 7, 1
  91.   SendColorLine 10, 8, "displayed.  Make sure you are using an ANSI terminal, then press" + crlf$, 7, 1
  92.   SendColorLine 11, 8, "any key (ESC to EXIT):", 7, 1
  93.   
  94.   K$ = Hitkey$(Who)
  95.   IF K$ = CHR$(27) THEN EXIT SUB
  96.  
  97.   DisplayType = 1
  98.   GOSUB DrawPattern
  99.   IF ch = -1 THEN
  100.     SendColorLine 13, 1, "File not found.", 7, 0
  101.     K$ = Hitkey$(Who)
  102.   ELSE
  103.     EnterKey "Press [|MENTER|B] to continue.", 9, 0, 23, 1
  104.   END IF
  105.  
  106.   ChangeColor 0, 0
  107.   ClearWindow
  108.  
  109.   MakeWindow 1, 2, 5, 79, "", "", 1, 9, 0, 1, 0
  110.   SendColorLine 2, 8, "Now look at the same file, except this time in AVATAR!  The", 7, 1
  111.   SendColorLine 3, 8, "display speed typically increases 25-30% compared to ANSI.", 7, 1
  112.   SendColorLine 4, 8, "Set your terminal to AVATAR, then press any key (ESC to EXIT):", 7, 1
  113.  
  114.   K$ = Hitkey$(Who)
  115.   IF K$ = CHR$(27) THEN EXIT SUB
  116.   
  117.   DisplayType = 2
  118.   GOSUB DrawPattern
  119.   IF ch = -1 THEN
  120.     SendColorLine 6, 1, "File not found.", 7, 0
  121.     K$ = Hitkey$(Who)
  122.   ELSE
  123.     EnterKey "Press [|MENTER|B] to continue.", 9, 0, 23, 1
  124.   END IF
  125.   
  126.   DisplayType = DisplayTypeOld
  127.  
  128.   EXIT SUB
  129.  
  130. DrawPattern:
  131.   ChangeColor 0, 0
  132.   ClearWindow
  133.   ChangeColor 1, 0
  134.   FOR a = 2 TO 9
  135.     ChangePos a, a + 4
  136.     SendCode "─|B"
  137.     SendLongString STRING$(70 - a * 2, "─")
  138.     SendCode "|b─"
  139.   NEXT
  140.   SendColorLine 11, 31, "I N S T A  D O O R", 15, 0
  141.   ChangeColor 1, 0
  142.   FOR a = 13 TO 20
  143.     ChangePos a, 26 - a
  144.     SendCode "─|B"
  145.     SendLongString STRING$(a * 2 + 26, "─")
  146.     SendCode "|b─"
  147.   NEXT
  148.  
  149. RETURN
  150.  
  151. END SUB
  152.  
  153. SUB ColorCodeDemo
  154.  
  155.   ChangeColor 0, 0
  156.   ClearWindow
  157.  
  158.   MakeWindow 1, 31, 3, 49, "", "", 1, 9, 0, 1, 0
  159.   SendColorLine 2, 33, "COLOR CODE Demo", 7, 1
  160.  
  161.   MakeWindow 5, 2, 9, 79, "", "", 1, 9, 0, 1, 0
  162.   SendColorLine 6, 6, "You can embed color codes in text to change colors on the fly instead", 7, 1
  163.   SendColorLine 7, 6, "of using ChangeColor commands.  A color code is a pipe ('|') followed", 7, 1
  164.   SendColorLine 8, 6, "by a single letter representing the color you wish to change to:", 7, 1
  165.  
  166.   ChangePos 11, 1
  167.   ChangeColor 1, 0
  168.   SendCode "            b = BLUE, |gg = GREEN, |cc = CYAN, |rr = RED, |mM = MAGENTA," + CHR$(13) + CHR$(10)
  169.   SendCode "            |yy = BROWN, |ww = LIGHT GREY, |LL = DARK GREY, |BB = LIGHT BLUE," + CHR$(13) + CHR$(10)
  170.   SendCode "            |GG = LIGHT GREEN, |CC = LIGHT CYAN, |RR = LIGHT RED," + CHR$(13) + CHR$(10)
  171.   SendCode "            |MM = PURPLE, |YY = YELLOW, |WW = WHITE" + CHR$(13) + CHR$(10) + CHR$(10)
  172.   
  173.   ChangeColor 7, 0
  174.   SendPlainCode "FOR EXAMPLE:" + CHR$(13) + CHR$(10) + CHR$(10)
  175.   SendPlainCode "   |wThis is an |Yexample |wof a |Rtext string |wwith |Gembeded color codes!" + CHR$(13) + CHR$(10)
  176.   SendCode "         |wThis is an |Yexample |wof a |Rtext string |wwith |Gembeded color codes!"
  177.  
  178.   EnterKey "Press [|MENTER|B] to continue.", 9, 0, 23, 1
  179.   
  180. END SUB
  181.  
  182. SUB DetectDemo
  183.  
  184.   ChangeColor 0, 0
  185.   ClearWindow
  186.  
  187.   MakeWindow 1, 25, 4, 54, "", "", 1, 9, 0, 1, 0
  188.   SendColorLine 2, 27, "ANSI/AVATAR DETECTION Demo", 7, 1
  189.   SendColorLine 3, 33, "Press any key", 7, 1
  190.  
  191.   K$ = Hitkey$(Who)
  192.  
  193.   ChangeColor 0, 0
  194.   ch = CheckTermulation
  195.  
  196.   SendColorLine 11, 26, "The |YTERMINAL |wdetected is ", 7, 0
  197.  
  198.   SELECT CASE ch
  199.     CASE 0
  200.       tmp$ = "|YNONE"
  201.     CASE 1
  202.       tmp$ = "|YANSI"
  203.     CASE 2
  204.       tmp$ = "|YAVATAR"
  205.   END SELECT
  206.  
  207.   SendCode tmp$
  208.  
  209.   EnterKey "Press [|MENTER|B] to continue.", 9, 0, 23, 1
  210.  
  211. END SUB
  212.  
  213. SUB DialogBoxDemo
  214.  
  215.  ChangeColor 0, 0
  216.  ClearWindow
  217.  
  218.  MakeWindow 1, 1, 5, 80, "", "", 1, 9, 0, 1, 0
  219.  
  220.  SendColorLine 2, 8, "With INSTA-DOOR you have a scrollable Dialog Box to use in your", 7, 1
  221.  SendColorLine 3, 7, "programs.  Turn NUM LOCK on so you can use the keypad to move the bar", 7, 1
  222.  SendColorLine 4, 35, "up and down.", 7, 1
  223.  
  224.  MakeWindow 20, 1, 22, 80, "", "", 1, 9, 0, 1, 0
  225.  SendColorLine 21, 4, "[2]=Down  [8]=Up [3]=PgDn [9]=PgUp [7]=Top [1]=Bottom [ENTER]=Select Item", 7, 1
  226.  
  227.  MakeWindow 9, 40, 15, 70, "", "", 1, 9, 0, 1, 0
  228.  SendColorLine 11, 43, "Here is a mini dialog box", 7, 1
  229.  SendColorLine 12, 43, "which contains only five", 7, 1
  230.  SendColorLine 13, 43, "items.  Please select one.", 7, 1
  231.  
  232.  REDIM List$(5)
  233.  FOR p = 1 TO 5
  234.   List$(p) = "Item #" + LTRIM$(STR$(p))
  235.  NEXT
  236.  
  237.  ch = DialogBox(List$(), 9, 15, 5, 10, "N", "N", "N", 1, 9, 0, 1, 7)
  238.  
  239.  MakeWindow 9, 40, 15, 70, "", "", 1, 9, 0, 1, 0
  240.  SendColorLine 12, 47, List$(ch) + " selected.", 7, 1
  241.  SendColorLine 14, 44, "Press a key to continue.", 13, 1
  242.  K$ = Hitkey$(Who)
  243.  
  244.  ERASE List$
  245.  
  246.  MakeWindow 9, 40, 15, 70, "", "", 1, 9, 0, 1, 0
  247.  SendColorLine 11, 42, "Now here is a dialog box", 7, 1
  248.  SendColorLine 12, 42, "which contains fifty", 7, 1
  249.  SendColorLine 13, 42, "choices.  Please select one.", 7, 1
  250.  
  251.  REDIM List$(50)
  252.  FOR p = 1 TO 50
  253.   List$(p) = "Item #" + LTRIM$(STR$(p))
  254.  NEXT
  255.  
  256.  ch = DialogBox(List$(), 9, 15, 5, 10, "N", "N", "N", 1, 9, 0, 1, 7)
  257.  
  258.  MakeWindow 9, 40, 15, 70, "", "", 1, 9, 0, 1, 0
  259.  SendColorLine 12, 47, List$(ch) + " selected.", 7, 1
  260.  SendColorLine 14, 44, "Press a key to continue.", 13, 1
  261.  K$ = Hitkey$(Who)
  262.  
  263.  ERASE List$
  264.  
  265. END SUB
  266.  
  267. SUB GetRestoreDemo
  268.  
  269.   ChangeColor 0, 0
  270.   ClearWindow
  271.  
  272.   MakeWindow 1, 30, 3, 49, "", "", 1, 9, 0, 1, 0
  273.   SendColorLine 2, 32, "GET/RESTORE Demo", 7, 1
  274.  
  275.   MakeWindow 5, 2, 8, 79, "", "", 1, 9, 0, 1, 0
  276.   SendColorLine 6, 8, "With GetANSIScreen and PutANSIScreen, you can save and restore", 7, 1
  277.   SendColorLine 7, 8, "parts of the screen.  Press any key (ESC to EXIT):", 7, 1
  278.  
  279.   K$ = Hitkey$(Who)
  280.   IF K$ = CHR$(27) THEN EXIT SUB
  281.  
  282.   REDIM scrn1(1000)
  283.   REDIM scrn2(1000)
  284.   REDIM scrn3(1000)
  285.   REDIM scrn4(2000)
  286.  
  287.   GetAnsiScreen scrn1(), 10, 12, 14, 34
  288.   MakeWindow 10, 12, 14, 34, "", "", 1, 8, 8, 2, 0
  289.   GetAnsiScreen scrn2(), 12, 20, 18, 74
  290.   MakeWindow 12, 20, 18, 74, "", "", 2, 9, 9, 4, 0
  291.   GetAnsiScreen scrn3(), 10, 38, 22, 42
  292.   MakeWindow 10, 38, 22, 42, "", "", 3, 4, 4, 5, 0
  293.   GetAnsiScreen scrn4(), 14, 19, 16, 61
  294.   MakeWindow 14, 19, 16, 61, "", "", 1, 9, 0, 1, 0
  295.  
  296.   SendColorLine 15, 21, "Press any key to make windows disappear", 7, 1
  297.  
  298.   K$ = Hitkey$(Who)
  299.   PutAnsiScreen scrn4(), 14, 19, 16, 61, "N"
  300.   K$ = Hitkey$(Who)
  301.   PutAnsiScreen scrn3(), 10, 38, 22, 42, "N"
  302.   K$ = Hitkey$(Who)
  303.   PutAnsiScreen scrn2(), 12, 20, 18, 74, "N"
  304.   K$ = Hitkey$(Who)
  305.   PutAnsiScreen scrn1(), 10, 12, 14, 34, "N"
  306.  
  307.   EnterKey "Press [|MENTER|B] to continue.", 9, 0, 23, 1
  308.  
  309.   ERASE scrn1, scrn2, scrn3, scrn4
  310.  
  311.  
  312. END SUB
  313.  
  314. SUB InputDemo
  315.  
  316.   ChangeColor 0, 0
  317.   ClearWindow
  318.  
  319.   MakeWindow 1, 33, 3, 46, "", "", 1, 9, 0, 1, 0
  320.   SendColorLine 2, 35, "INPUT Demo", 7, 1
  321.  
  322.   MakeWindow 5, 2, 9, 79, "", "", 1, 9, 0, 1, 0
  323.   SendColorLine 6, 4, "With the command INPUTDATA, you can get INPUT into your programs.  You can", 7, 1
  324.   SendColorLine 7, 4, "set the input field text and length beforehand, and you can control the", 7, 1
  325.   SendColorLine 8, 4, "colors of the field.", 7, 1
  326.   
  327.   SendColorLine 12, 18, "See what I mean?  ", 5, 0
  328.   ans$ = InputData(25, 15, 1, " Yes I do!", "", "")
  329.  
  330.   EnterKey "Press [|MENTER|B] to continue.", 9, 0, 23, 1
  331.  
  332. END SUB
  333.  
  334. SUB MakeWindowDemo
  335.  
  336.   ChangeColor 0, 0
  337.   ClearWindow
  338.  
  339.   MakeWindow 1, 31, 3, 49, "", "", 1, 9, 0, 1, 0
  340.   SendColorLine 2, 33, "MakeWindow Demo", 7, 1
  341.  
  342.   MakeWindow 5, 2, 8, 79, "", "", 1, 9, 0, 1, 0
  343.   SendColorLine 6, 8, "Using the MakeWindow command, you can make windows of any size, with", 7, 1
  344.   SendColorLine 7, 8, "different bordertypes, different colors, etc.  Press a key to see!", 7, 1
  345.  
  346.   K$ = Hitkey$(Who)
  347.  
  348.   FOR a = 1 TO 10
  349.     Row = INT(RND * 5) + 10
  350.     row2 = Row + INT(RND * 10) + 1
  351.     IF row2 > 22 THEN row2 = 22
  352.     Col = INT(RND * 70) + 2
  353.     col2 = Col + INT(RND * 50) + 1
  354.     IF col2 > 79 THEN col2 = 79
  355.     bt = INT(RND * 3) + 1
  356.     bkg = INT(RND * 8)
  357.     DO
  358.       tfc = INT(RND * 16)
  359.       bfc = INT(RND * 16)
  360.     LOOP UNTIL tfc <> bkg AND bfc <> bkg
  361.     hdr = INT(RND * 16)
  362.     MakeWindow Row, Col, row2, col2, "", "", bt, tfc, bfc, bkg, hdr
  363.   NEXT
  364.  
  365.   EnterKey "Press [|MENTER|B] to continue.", 9, 0, 23, 1
  366.  
  367. END SUB
  368.  
  369. SUB MusicDemo
  370.  
  371.   ChangeColor 0, 0
  372.   ClearWindow
  373.  
  374.   MakeWindow 1, 33, 3, 46, "", "", 1, 9, 0, 1, 0
  375.   SendColorLine 2, 35, "MUSIC Demo", 7, 1
  376.  
  377.   MakeWindow 5, 2, 8, 79, "", "", 1, 9, 0, 1, 0
  378.   SendColorLine 6, 8, "The ANSI\AVATAR driver supports ANSI music.  Turn MUSIC ON in your", 7, 1
  379.   SendColorLine 7, 8, "terminal program, then choose a song:", 7, 1
  380.  
  381.   REDIM List$(5)
  382.   List$(1) = "The Addams Family"
  383.   List$(2) = "Leave it to Beaver"
  384.   List$(3) = "Jeopardy Theme"
  385.   List$(4) = "James Bond"
  386.   List$(5) = "Beverly Hill Cop"
  387.   ch = DialogBox(List$(), 10, 30, 5, 18, "Y", "Y", "Y", 1, 9, 0, 1, 7)
  388.   IF ch = -1 THEN EXIT SUB
  389.  
  390.   SELECT CASE ch
  391.     CASE 1
  392.       m$ = "L16O2G>C8EC8<AF8>D5C<B8>D<B8GE8>C5<G>C8EC8<AF8>D5C<B8GA8B>C4"
  393.     CASE 2
  394.       m$ = "L16O2G>C8EGECD8FA8GF#G>C<A8FD3<G>C8EGECD8FA8GF#G>C<AD<B>C8"
  395.     CASE 3
  396.       m$ = "T75L16O2G8>C8<G8C8G8>C8<G4G8>C8<G8>C8E5DC<BAG#G8>C8<G8CCG8>C8<G4>C5<AG8F8E8D8C8"
  397.     CASE 4
  398.       m$ = "T65L16O2D8<G>DD#8<G>D#E8<G>ED#8<G>D#D8<G>DD#8<G>D#E8<G>ED#8<G>D#"
  399.     CASE 5
  400.       m$ = "T125L16O2G4B-5G8G>C8<G8F8G4>D5<G8G>D#8D8<B-8G8>D8G8<GF8FD8A8G4"
  401.   END SELECT
  402.  
  403.   ANSIMusic m$
  404.  
  405.   EnterKey "Press [|MENTER|B] to continue.", 9, 0, 23, 1
  406.  
  407. END SUB
  408.  
  409. SUB OpeningScreen
  410.  
  411.   ChangeColor 0, 0
  412.   ClearWindow
  413.   MakeWindow 1, 2, 5, 79, "", "", 1, 9, 0, 1, 0
  414.   MakeWindow 21, 2, 23, 79, "", "", 1, 9, 0, 1, 0
  415.  
  416.   SendColorLine 2, 28, "INSTA-DOOR(TM) Demo v1.0", 7, 1
  417.   SendColorLine 3, 23, "Copyright (C) M&J Alliance Software", 7, 1
  418.   SendColorLine 4, 31, "ALL RIGHTS RESERVED", 7, 1
  419.   SendColorLine 22, 6, "[2]=Down, [8]=Up, [7]=Top, [1]=Bottom, [ENTER]=Select Item, [ESC]=Exit", 7, 1
  420.   
  421. END SUB
  422.  
  423.